package com.yihaodian.index.solr;

import org.apache.lucene.index.IndexReader;
import org.apache.lucene.search.IndexSearcher;
import org.apache.solr.core.SolrCore;

import com.yihaodian.api.search.SearchException;
import com.yihaodian.search.core.Searcher;

public class SolrSearcher implements Searcher{

    private SolrCore solrCore;
	
//	private IndexShard indexShard;
	
	public SolrSearcher(SolrCore solrCore){
//		this.indexShard=indexShard;
		this.solrCore = solrCore;
	}

	public SolrCore getSolrCore() {
		return solrCore;
	}

//	public IndexShard getIndexShard() {
//		return indexShard;
//	}
//
//	public void setIndexShard(IndexShard indexShard) {
//		this.indexShard = indexShard;
//	}

	@Override
	public boolean release() throws SearchException {
		return true;
	}

	@Override
	public IndexReader reader() {
		return searcher().getIndexReader();
	}

	@Override
	public IndexSearcher searcher() {
		return solrCore.getSearcher().get();
	}

}
